home *** CD-ROM | disk | FTP | other *** search
- .KF:strg.toc
- .R:E
- .W:96
- .H:...DML STRG UNIT Version 1.00...
- .H:...$$Day Mon D, YEAR$$ $$Z:MI A.M.$$ Page $$$...
- .H:
- .F:
- .F:... Copyright (c) 1989, by DML Software Inc. ...
- .X:8
-
- .K:STRING ROUTINES - CHANGES HIGHLIGHTS (VERSION 1.00)
- STRING ROUTINES - CHANGES HIGHLIGHTS (VERSION 1.00)
-
- 1/1/89 Initial Release
-
-
-
- .K:1) GENERAL PURPOSE STRING
- 1) GENERAL PURPOSE STRING
-
- NAME
- .K:StrConstants
- StrConstants
-
- SYNOPSIS
- The constants defined here are for use with the string conversion
- routines. Each constant has two names: a long, descriptive name and a
- short name.
-
- DESCRIPTION
-
- Constant Name Alt Name Meanings
- ------------- -------- ------------------------------------------------
- S_IgnoreQuoted (S_I) Do not process characters within quotes (' or ")
- S_AllSpaces (S_A) Strip all spaces and tabs
- S_Leading (S_L) Strip all leading spaces and tabs
- S_Trailing (S_T) Strip all trailing spaces and tabs
- S_ReduceToOneSpace (S_R) Reduce all spaces and tabs to one space
- S_ToUpper (S_U) Convert lower case letters to upper case
- S_ToLower (S_D) Convert upper case letters to lower case
-
- SEE ALSO
- Strip, StrCase
-
- DEPENDS ON
-
- DIAGNOSTICS
-
- KNOWN RESTRICTIONS
-
- PARTIALLY OBSOLETED BY
-
- UPDATE HISTORY
-
-
-
- NAME
- .K:RJS - Right Justify String
- RJS - Right Justify String
-
- SYNOPSIS
- FUNCTION RJS (Source: STRING; Size : BYTE) : STRING;
-
- WRITELN (RJS ('Right', 40));
-
-
- DESCRIPTION
- Returns a string preceeded by enough spaces to pad the result to the
- size parameter.
-
- SEE ALSO
- CJS - Center Justify String, LJS - Left Justify String
-
- DEPENDS ON
-
- DIAGNOSTICS
- If the length of the source string is longer than the Size parameter a
- "^" will be added to the result indicating that the field has
- overflowed.
-
- KNOWN RESTRICTIONS
-
- PARTIALLY OBSOLETED BY
-
- UPDATE HISTORY
-
-
-
- NAME
- .K:LJS - Left Justify String
- LJS - Left Justify String
-
- SYNOPSIS
- FUNCTION LJS (Source : STRING; Size : BYTE) : STRING;
-
- WRITELN (LJS ('Left', 40));
-
- DESCRIPTION
- Returns the Source string followed by spaces to pad the string to the
- Size parameter.
-
- SEE ALSO
- CJS - Center Justify String, RJS - Right Justify String
-
- DEPENDS ON
-
- DIAGNOSTICS
- If the Source string is longer than the Size parameter a "^" character
- will be returned indicating that the field has overflowed.
-
- KNOWN RESTRICTIONS
-
- PARTIALLY OBSOLETED BY
-
- UPDATE HISTORY
-
-
-
- NAME
- .K:CJS - Center Justify String
- CJS - Center Justify String
-
- SYNOPSIS
- FUNCTION CJS (Source: STRING; Size : BYTE) : STRING;
-
- WRITELN (CJS ('Hello', 80));
-
- DESCRIPTION
- Places the Source string in the center of a string Size characters
- long.
-
- SEE ALSO
- RJS - Right Justify String, LJS - Left Justify String
-
- DEPENDS ON
-
- DIAGNOSTICS
- If the Source string is longer than the Size variable, as much of the
- source will be returned with a "^" character indicating field
- overflow.
-
- KNOWN RESTRICTIONS
-
- PARTIALLY OBSOLETED BY
-
- UPDATE HISTORY
-
-
-
- NAME
- .K:Strip - Removes blanks and tabs from a string.
- Strip - Removes blanks and tabs from a string.
-
- SYNOPSIS
- FUNCTION Strip (Source : STRING; Code : BYTE) : STRING;
-
- WRITELN ('>'+Strip (' Hello this is nice. '),S_AllSpaces)+'<');
- displays: >Hellothisisnice.<
-
- WRITELN ('>'+Strip (' Hello this is nice. '),S_Leading)+'<');
- displays: >Hello this is nice. <
-
- WRITELN ('>'+Strip (' Hello this is nice. '),
- S_Leading+S_Trailing)+'<');
- displays: >Hello this is nice.<
-
- WRITELN ('>'+Strip (' Hello this is nice. '),
- S_ReduceToOneSpace+'<');
- displays: > Hello this is nice. <
-
- To remove the leading and trailing spaces from the last example, you
- must combine S_ReduceToOneSpace with S_Leading and S_Trailing.
-
- DESCRIPTION
- Removes blanks (i.e. space characters) and tab characters from a
- string and returns the result. The original string is not altered.
- The second parameter, Code, determines the blanks to strip. Constant
- values have been defined for the following functions. Note that it is
- possible to combine several functions into the same call by adding the
- values of the constants together. For example, S_Leading+S_Trailing
- will strip both leading and trailing blanks. They are processed in
- the order shown below.
-
- Constant Name Meanings
- ------------- ------------------------------------------------
- S_IgnoreQuoted Do not process characters within quotes (' or ")
- S_AllSpaces Strip all spaces and tabs
- S_Leading Strip all leading spaces and tabs
- S_Trailing Strip all trailing spaces and tabs
- S_ReduceToOneSpace Reduce all spaces and tabs to one space
-
- SEE ALSO
- StrCase
-
-
- DEPENDS ON
-
- DIAGNOSTICS
-
- KNOWN RESTRICTIONS
-
- PARTIALLY OBSOLETED BY
-
- UPDATE HISTORY
-
-
-
- NAME
- .K:StrCase - Converts the case of all letters in a string.
- StrCase - Converts the case of all letters in a string.
-
- SYNOPSIS
- FUNCTION StrCase (Source : STRING; Code : BYTE) : STRING;
-
- WRITELN (StrCase ('uppercase', S_ToUpper));
-
- DESCRIPTION
- Conversion of case is done using the following codes. Note that
- Constants are defined for S_IgnoreQuoted - 16, S_ToUpper - 32, and
- S_ToLower - 64.
-
- Code String Conversion
- ---- -------------------------------------------
- 16 Characters enclosed in quotes are not to be
- altered during string conversion.
- 32 Convert all characters to upper case.
- 64 Convert all characters to lower case.
-
- Code can be any combination of the above values, even though some
- combinations are logically inconsistent. Any ambiguity is resolved by
- executing the conversion request codes in numerical order. The only
- exception is that code 16 (do not alter quoted strings) is always
- checked.
-
- SEE ALSO
- Strip
-
- DEPENDS ON
-
- DIAGNOSTICS
-
- KNOWN RESTRICTIONS
-
- PARTIALLY OBSOLETED BY
-
- UPDATE HISTORY
-
-
-
- NAME
- .K:StrField - Returns a field from a delimited string.
- StrField - Returns a field from a delimited string.
-
- SYNOPSIS
- FUNCTION StrField (Source : STRING; Delimiter : CHAR; Num : BYTE) : STRING;
-
- WRITELN ('>'+StrField ('NumOne,NumTwo,NumThree', ',', 2)+'<');
- displays: >NumTwo<
-
- DESCRIPTION
- Returns the string field (i.e. substring) between the delimiter
- characters. Num is used to indicate that the substring starts after
- the Num-1 delimiter. This routine will only return one field per
- call. The delimiter characters are NOT returned. If you ask for the
- first field and the delimiter is not found, the entire source string
- is returned. If you ask for the second field and the delimiter is not
- found, then the null field is returned.
-
- SEE ALSO
-
- DEPENDS ON
-
- DIAGNOSTICS
-
- KNOWN RESTRICTIONS
-
- PARTIALLY OBSOLETED BY
-
- UPDATE HISTORY
-
-
-
- NAME
- .K:StrFill - Fill a string with a character.
- StrFill - Fill a string with a character.
-
- SYNOPSIS
- FUNCTION StrFill (FillCh : CHAR; Num : BYTE) : STRING;
-
- WRITELN (StrFill ('*', 80);
-
- DESCRIPTION
- The first parameter specifies the character, and the second specifies
- the length of the returned string.
-
- SEE ALSO
-
- DEPENDS ON
-
- DIAGNOSTICS
-
- KNOWN RESTRICTIONS
-
- PARTIALLY OBSOLETED BY
-
- UPDATE HISTORY
-
-
-
- NAME
- .K:StrPad - Blank pad a string.
- StrPad- Blank pad a string.
-
- SYNOPSIS
- FUNCTION StrPad (Source : STRING) : STRING;
-
- Str1 := StrPad(Str1);
-
- DESCRIPTION
- This function pads a string with blanks (spaces). It is similar to right
- justifying a string, except the length is implicit; the size of the
- result field actually determines the number of blanks padded.
-
- SEE ALSO
-
- DEPENDS ON
-
- DIAGNOSTICS
-
- KNOWN RESTRICTIONS
-
- PARTIALLY OBSOLETED BY
-
- UPDATE HISTORY
-
-
-
- NAME
- .K:StrShiftLeft - Shift a string left one character.
- StrShiftLeft - Shift a string left one character.
-
- SYNOPSIS
- FUNCTION StrShiftLeft (Fld : STRING; Posit : BYTE) : STRING;
-
- Str1 := StrShiftLeft('ABCDEFGHIJKLMNOPQRSTUVWXYZ',13);
-
- DESCRIPTION
- This function removes a single character, whose position is specified by
- the second parameter from the string specified by the first parameter.
- The resulting string is one character longer than the original string.
- This function avoids having to code two COPY statements to achieve the
- same result.
-
- SEE ALSO
-
- DEPENDS ON
-
- DIAGNOSTICS
-
- KNOWN RESTRICTIONS
-
- PARTIALLY OBSOLETED BY
-
- UPDATE HISTORY
-
-
-
- NAME
- .K:StrShiftRight - Shift a string right one character.
- StrShiftRight - Shift a string right one character.
-
- SYNOPSIS
- FUNCTION StrShiftRight (Fld : STRING; Posit : BYTE; Fill : CHAR) : STRING;
-
- Str1 := StrShiftLeft(Str1,13,'M');
-
- DESCRIPTION
- This function inserts a single character into the 'middle' of a string.
- The 'rest' of the string is shifted right one character position. The
- first parameter specifies the string, the second the position into which
- the third parameter will be placed. The resulting string is one
- character longer than the original string. This function avoids having to
- code two COPY statements to achieve the same result.
-
- SEE ALSO
-
- DEPENDS ON
-
- DIAGNOSTICS
-
- KNOWN RESTRICTIONS
-
- PARTIALLY OBSOLETED BY
-
- UPDATE HISTORY
-
-
-
- .K:2) STRING CONVERSION
- 2) STRING CONVERSION
-
- NAME
- .K:S2C - Convert a String into a Character Array.
- S2C - Convert a String into a Character Array.
-
- SYNOPSIS
- PROCEDURE S2C (Strg : STRING ; VAR CharA ; Len : BYTE);
-
- S2C (MyString,MyCharArray,LENGTH(MyCharArray));
-
- DESCRIPTION
- This routine strips out the length byte of a string, and transfers all
- the remaining used bytes of the string to an array of characters. The
- character array is blank padded to the length specified by the length
- parameter, up to 255 bytes. If the length parameter specifies a length
- greater than the actual character array, following bytes in memory will be
- clobbered. This routine is useful for transfering Turbo strings to DBMSs,
- etc., that only support character arrays.
-
- SEE ALSO
-
- DEPENDS ON
-
- DIAGNOSTICS
-
- KNOWN RESTRICTIONS
-
- PARTIALLY OBSOLETED BY
-
- UPDATE HISTORY
-
-
-
- NAME
- .K:C2S - Coverts a character array to a string.
- C2S - Coverts a character array to a string.
-
- SYNOPSIS
- FUNCTION C2S (VAR CharA ; Len : BYTE) : STRING;
-
- MyString := C2S (MyCharArray,SIZEOF(MyCharArray));
-
- DESCRIPTION
- This routine transfers bytes from the character array to the string. The
- number of bytes transfered is specified by the length parameter up to 255
- bytes; the string length byte is set to this parameter. This routine is
- useful for reading text import files of fixed length character fields.
-
- SEE ALSO
-
- DEPENDS ON
-
- DIAGNOSTICS
-
- KNOWN RESTRICTIONS
-
- PARTIALLY OBSOLETED BY
-
- UPDATE HISTORY
-
-
-
- NAME
- .K:S2Z - Convert a string in a DOS AsciiZ string.
- S2Z - Convert a string in a DOS AsciiZ string.
-
- SYNOPSIS
- PROCEDURE S2Z (Strg : STRING ; VAR CharA);
-
- S2Z (MyString,MyCharArray);
-
- DESCRIPTION
- This routine strips out the length byte of a string, transfers all the
- remaining used bytes of the string to an array of characters, and
- terminates the used portion of the character array with a zero byte. If
- the actual character array isn't large enough to hold the AsciiZ string,
- following bytes in memory will be clobbered. This routine is useful for
- using DOS file handling routines directly.
-
- SEE ALSO
-
- DEPENDS ON
-
- DIAGNOSTICS
-
- KNOWN RESTRICTIONS
-
- PARTIALLY OBSOLETED BY
-
- UPDATE HISTORY
-
-
-
- NAME
- .K:Z2S - Convert an AsciiZ string to a string.
- Z2S - Convert an AsciiZ string to a string.
-
- SYNOPSIS
- FUNCTION Z2S (VAR CharA) : STRING;
-
- MyString := Z2S (MyCharArray);
-
- DESCRIPTION
- This routine transfers bytes from the character array to the string. The
- number of bytes transfered is determine by the zero byte terminating the
- character array, or 255 bytes transfered, whichever occurs first. the
- string length byte is set to the number of bytes transfered.
-
- SEE ALSO
-
- DEPENDS ON
-
- DIAGNOSTICS
-
- KNOWN RESTRICTIONS
-
- PARTIALLY OBSOLETED BY
-
- UPDATE HISTORY
-
-
-
-